package com.njitzx.controller;

import com.njitzx.entity.vo.*;
import com.njitzx.service.ReportService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping ("/reports")
@RequiredArgsConstructor
public class ReportController {

    private final ReportService reportService;
    @ApiOperation("实时数据统计")
    @GetMapping("/live")
    public Result  getLiveReport(){
       LiveReportVO liveReportVO= reportService.getLiveReport();
        return Result.success(liveReportVO);
    }
    @ApiOperation("营业额统计")
    @GetMapping("/turnover")
    public Result  getTurnoverReport(){
        TurnoverVO turnoverVO=reportService.getTurnoverReport();
        return Result.success(turnoverVO);
    }
  @ApiOperation("订单状态统计")
    @GetMapping("/orderStatus")
    public Result getOrderStatus(){
        OrderStatusVO orderStatusVO=reportService.getOrderStatus();
        return Result.success(orderStatusVO);
    }
    @ApiOperation("支付方式统计")
    @GetMapping("/payMethod")
    public Result payMethod(){
         PayMethodVO payMethodVO= reportService.getPayMethod();
         return Result.success(payMethodVO);
    }

    @ApiOperation("分类销量排名TOP10")
    @GetMapping("/top10")
    public Result  getTop10(){
        Top10VO top10VO=reportService.top10();
        return  Result.success(top10VO);
    }
}
